import pytest


# @pytest.fixture(autouse=True)  # autouse 是自动调用
# def data1():
#     return [{
#         "request": {
#             "headers": {
#                 "content-type": "application/json"
#             },
#             "params": {
#                 "s": "api/user/login",
#                 "application": "app",
#                 "application_client_type": "weixin"
#             },
#             "json": {
#                 "accounts": "Qik1",
#                 "pwd": "123456",
#                 "type": "username"
#             },
#
#             "method": "post",
#             "url": "http://shop-xo.hctestedu.com:80/index.php"
#         },
#         "extract_data": {
#             "id": "$.data.id",
#             "token":"$.data.token"
#         },
#
#         "assert_business":
#             {"$.code": 0, "$.msg": "登录成功", "$.data.username": "Qik1"},
#         "assert_sql": {
#             "dql": "select token from sxo_user where id = ${id};",
#             "sql_jsonpath": "$.token",
#             "r_jsonpath": "$.data.token"
#         }
#     },
#         {
#         "request": {
#             "headers": {
#                 "content-type": "application/json"
#             },
#             "params": {
#                 "s": "api/message/index",
#                 "application": "app",
#                 "application_client_type": "weixin",
#                 "token":"${token}"
#             },
#             "json": {
#                 "page": 1
#             },
#
#             "method": "post",
#             "url": "http://shop-xo.hctestedu.com:80/index.php"
#         }
#
#     }
#
#     ]

@pytest.fixture(autouse=True)  # autouse 是自动调用
def data():
    return [{
        "request": {
            "headers": {
                "content-type": "application/json"
            },
            "params": {
                "s": "api/user/login",
                "application": "web",
                "application_client_type": "pc"
            },
            "json": {
                "accounts": "Qik1",
                "pwd": "123456",
                "type": "username"
            },

            "method": "post",
            "url": "http://shop-xo.hctestedu.com:80/index.php"
        },

        "assert_business":
            {"$.code": 0, "$.msg": "登录成功"},
    }, {
        "request": {
            "headers": {
                "content-type": "application/json"
            },
            "params": {
                "s": "api/message/index",
                "application": "web",
                "application_client_type": "pc"
            },
            "json": {
                "page": 1
            },

            "method": "post",
            "url": "http://shop-xo.hctestedu.com:80/index.php",
        }

    }]
